#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/12/11 23:11
# @Author  : lizhen
# @Site    : 
# @File    : cScipy.py
# @Software: PyCharm
from PIL import Image
from matplotlib.pyplot import figure, subplot
from numpy import array
from scipy.ndimage import filters
from scipy.misc import imsave, imshow


class ScipyDemo:
    def __init__(self):
        self.image = Image.open('ext/cScipy/earth.jpg')
        self.image_file = 'ext/cScipy/{}.jpg'

    def _test_vague(self):
        """
        sd = ScipyDemo()
        sd._test_vague()
        """
        figure()
        image = self.image
        im = array(image.convert('L'))
        imsave(self.image_file.format('earth_l'), im)

        im2 = filters.gaussian_filter(im, 5)  # 标准差为5
        imsave(self.image_file.format('earth_gauss'), im2)


if __name__ == '__main__':
    sd = ScipyDemo()
    sd._test_vague()
